package com.nenude.corejava.ch10;

import java.util.Stack;

public class StackClass {

	public static void main(String[] args) {
		//stack栈结构，FILO
		Stack<Computer> stack=new Stack<>();
		
		//栈操作：压栈和弹栈
		//压栈(存数据)
		for (int i=0;i<10;i++) {
			stack.push(new Computer("HP"+i,5000+i));
		}
		
		//弹栈(取数据)
	    Computer computer=null;
	    while((computer=stack.pop())!=null){
	    	System.out.println(computer);	    	
	    	if(stack.isEmpty()){
	    		break;
	    	}		
	    }

	}

}
